import { ILoginAccount } from './types'
import ccRequest from '@/service'
import { ILoginType } from '@/store/login/types'
import { IResponseResult } from '../request/type'

enum LoginAPI {
  AccountLogin = '/login/in',
  UserMenu = '/vue3menu/tree',
  UserMenuNoRoot = '/vue3menu/menus', // 没有 root 的菜单数组
  UserMenu2 = '/vue3menu/list'
}

function accountLoginRequest(loginParam: ILoginAccount) {
  return ccRequest.post<IResponseResult<ILoginType>>({
    url: LoginAPI.AccountLogin,
    data: loginParam
  })
}

function getUserMenu() {
  return ccRequest.get<IResponseResult>({
    url: LoginAPI.UserMenuNoRoot
  })
}

export { accountLoginRequest, getUserMenu }
